package com.vanzo.ui;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.vanzo.adapter.TalkieFollowerAdapter;
import com.vanzo.encryption.R;

/**
 * Created by yaofang on 2018/3/5.
 */

public class ContactFragment extends BaseFragment2 {

    private RecyclerView recycler;
    private TalkieFollowerAdapter adapter;

    @Override
    protected int getFragmentLayoutId() {
        return R.layout.fragment_contact;
    }

    @Override
    protected void initView() {
        TextView mTitle = (TextView) getRoot().findViewById(R.id.tv_title);
        mTitle.setText("联系人");
        recycler = (RecyclerView) getRoot().findViewById(R.id.contact_recycler);
        recycler.setLayoutManager(new LinearLayoutManager(getActivity()));
        adapter = new TalkieFollowerAdapter(getActivity());
        adapter.setFollowers(tpplication.getFollowers());
        recycler.setAdapter(adapter);
    }

    @Override
    protected void initListener() {

    }

    @Override
    protected void initData() {

    }

    @Override
    public void onResume() {
        super.onResume();
        adapter.setFollowers(tpplication.getFollowers());
    }

    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
        if (isVisibleToUser) {
            if (adapter != null)
                adapter.setFollowers(tpplication.getFollowers());
        } else {

        }
    }
}
